home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7747 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.6 KB

  1. Path: news.orl.mmc.com!usenet
  2. From: Ted Dennison <dennison@escmail.orl.mmc.com>
  3. Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
  4. Subject: Re: C/C++ knocks the crap out of Ada
  5. Date: Mon, 19 Feb 1996 12:36:21 -0500
  6. Organization: Lockheed Martin Marine Systems
  7. Message-ID: <3128B515.41AA@escmail.orl.mmc.com>
  8. References: <4etcmm$lpd@nova.dimensional.com> <4f4ptt$a1c@newsbf02.news.aol.com> <4g1b7n$l5@mailhub.scitec.com.au> <3124B2F3.6D21@escmail.orl.mmc.com> <4g8mjm$bce@mailhub.scitec.com.au>
  9. NNTP-Posting-Host: bubba_4.orl.mmc.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (X11; I; HP-UX A.09.01 9000/750)
  14.  
  15. Ramses Youhana wrote:
  16. > Ted Dennison (dennison@escmail.orl.mmc.com) wrote:
  17. > > Quite true. But having "cleaned up" both, I can tell you Ada is MUCH
  18. > > easier to detangle.
  19. > That's interesting.  Is this due to the language itself, or the way
  20. > the programs were written or both?  I have had to "detangle" other
  21.  
  22. I'd say due to the language.
  23.  
  24. > peoples C code on many occasions.  Those that were well written
  25. > were very easy to fix, however, the majority were incredibly poorly
  26. > written.  These were very hard to fix, and in many cases, the code had
  27. > to be re-written.  All of these problems were due to the poor design and
  28. > coding habits of the programmer and not the C language.  I am wonderring
  29. > how much protection Ada provides against bad programmers and engineers.
  30. > I know that C doesn't provide much protection.  This is one reason why
  31. > it is important to design the system first (on paper) before one starts
  32. > coding.
  33.  
  34. Well, for the quailty developers you've got a language with integral
  35. facilities for information hiding, and strong typing to preserve the
  36. integrity of their objects. 
  37.  
  38. For your average developers, you've got a language where pointers are
  39. NOT used for arrays and parameter passing. And when pointers ARE used,
  40. they are NOT assignment-compatable with integers and characters and
  41. pointers to objects of another type. This cuts out a lot of the most
  42. common C errors. 
  43.  
  44. You also have a language where array bounds are checked. For those of
  45. you who follow Unix security, you know that the single most common 
  46. cause of Unix security holes is due buffer overflow conditions on
  47. arrays wihtout range checking. Hackers know about Unix's C 
  48. shortcommings, and exploit this lack of range checking to insert 
  49. their own code into a running  Unix job with root privs. If Unix 
  50. were written in a language with range checking, a whole cottage 
  51. industry of Unix security consultants would be put out of work.
  52.  
  53. Also, proper use of typing will prevent errors like garbage data
  54. propagating through a system (sometimes a network!) and crashing
  55. a seeminly unrelated routine (eg: when it tries to index by that
  56. value).
  57.  
  58. The strong typing has one other effect. The extra pain involved in
  59. hosing the type checking encourages developers to think through their
  60. typing scheme ahead of time, and to choose wisely.
  61.  
  62. Thus for code written by average and above average coders, debugging
  63. typically means finding the cause of some Ada exception that occured,
  64. and adding code to handle that case.
  65.  
  66. For your poor developers, (who will often STILL write code that
  67. has to be rewritten), you have a language where aliasing is difficult
  68. and obvious when done. 
  69.  
  70. You have a language that forces separation of interfaces and 
  71. implementation. This not only makes important interface information 
  72. easier to locate (without having to wade through tons of irrelevant 
  73. code), but it also discourages poor develpers from hosing of your 
  74. "objects", by hiding the details of their implementation in another
  75. place. 
  76.  
  77. You also have a language whose package-based scoping rules imply that
  78. the rotten code is generally confined to one source file. This one 
  79. source file can usually be completely rewritten, WITHOUT changing the
  80. interface to the rest of the code at all. 
  81.  
  82. In practice, the only real way to write spaghetti code in Ada is the
  83. infamous "generic-ghetti". This involves using multiple levels of
  84. nested generics (usually with a lot of procedure parameters) in a
  85. structure so complex that it is nearly impossible to tell what the
  86. instantiated code does. (Here we often refer to it as "Frankel-ghetti",
  87. in honor of an STGT developer who managed to write an example so bad
  88. that the DEC Ada compiler simply spat out an "I give up" error message.)
  89. Once C++ folks start to figure out templates, they'll have this problem
  90. too.
  91.  
  92. -- 
  93. T.E.D.          
  94.                 |  Work - mailto:dennison@escmail.orl.mmc.com  |
  95.                 |  Home - mailto:dennison@iag.net              |
  96.                 |  URL  - http://www.iag.net/~dennison         |
  97.